package com.itheima.d2_byte_stream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * 目标：使用文件字节输入流一次读取完文件的全部字节。
 */
public class FileInputStreamTest3 {
    public static void main(String[] args) throws IOException {
        File file =new File("day09file-io-app/file/file.txt");
        FileInputStream fis = new FileInputStream("day09file-io-app/file/file.txt");
        byte[] all = new byte[(int)file.length()];
        fis.read(all);
        System.out.println(new String(all));
        fis.close();


        File file1 = new File("day09file-io-app/file/file.txt");
        FileInputStream fis1 = new FileInputStream(file1);
        byte[] bytes = fis1.readAllBytes();
        System.out.println(new String(bytes));
        fis1.close();


    }
}
